package com.siwei.mes.controller.system;

import com.siwei.mes.common.result.ApiResult;
import com.siwei.mes.common.result.Json;
import com.siwei.mes.common.validator.UpdateGroup;
import com.siwei.mes.entity.system.SystemConfig;
import com.siwei.mes.service.system.SystemConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 系统设置相关
 *
 * @author linzi
 * @since 2024-05-23 21:18:14
 */
@Api(value = "系统设置")
@RestController
@RequestMapping("systemConfig")
public class SystemConfigController {
    @Resource
    private SystemConfigService systemConfigService;

    @ApiOperation(value = "修改系统设置")
    @PostMapping("/update")
    public Json update(@RequestBody @Validated(UpdateGroup.class) SystemConfig entity) {
        systemConfigService.update(entity);
        return Json.succ().data(new ApiResult());
    }

    @ApiOperation(value = "获取系统配置")
    @GetMapping("init")
    public Json init() {
        return Json.succ().data(systemConfigService.init());
    }
}
